package com.ruoyi.customer.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.customer.mapper.CarMapper;
import com.ruoyi.customer.domain.Car;
import com.ruoyi.customer.service.ICarService;

/**
 * 购物车Service业务层处理
 *
 * @author jtm
 * @date 2024-12-07
 */
@Service
public class CarServiceImpl implements ICarService
{
    @Autowired
    private CarMapper carMapper;

    /**
     * 查询购物车
     *
     * @param userId 购物车主键
     * @return 购物车
     */
    @Override
    public Car selectCarByUserId(Long userId)
    {
        return carMapper.selectCarByUserId(userId);
    }

    /**
     * 查询购物车列表
     *
     * @param car 购物车
     * @return 购物车
     */
    @Override
    public List<Car> selectCarList(Car car)
    {
        return carMapper.selectCarList(car);
    }

    /**
     * 新增购物车
     *
     * @param car 购物车
     * @return 结果
     */
    @Override
    public int insertCar(Car car)
    {
        return carMapper.insertCar(car);
    }

    /**
     * 修改购物车
     *
     * @param car 购物车
     * @return 结果
     */
    @Override
    public int updateCar(Car car)
    {
        return carMapper.updateCar(car);
    }

    /**
     * 批量删除购物车
     *
     * @param userIds 需要删除的购物车主键
     * @return 结果
     */
    @Override
    public int deleteCarByUserIds(Long[] userIds)
    {
        return carMapper.deleteCarByUserIds(userIds);
    }

    /**
     * 删除购物车信息
     *
     * @param userId 购物车主键
     * @return 结果
     */
    @Override
    public int deleteCarByUserId(Long userId)
    {
        return carMapper.deleteCarByUserId(userId);
    }
}
